package com.example.demo.day0224;

/**
 * 生产工厂接口
 */
public interface BMWFactory {
    BMW product();//定义一个返回值类型为BMW的抽象方法
}

/**
 * 实现具体的类的工厂
 */
class BMW3Factory implements BMWFactory{
    public BMW product() {
        System.out.println("product BMW3");
        return new BMW3();
    }
}
class BMW5Factory implements BMWFactory{
    public BMW product() {
        System.out.println("product BMW5");
        return new BMW5();
    }
}
class BMW7Factory implements BMWFactory{
    public BMW product() {
        System.out.println("product BMW7");
        return new BMW7();
    }
}